// 
// menu.scss
//

// Metis Menu Overwrite

.metismenu {
    padding: 0;
    ul {
        padding: 0;
        li {
            list-style: none;
            width: 100%;
        }
    }
}

.nav-second-level,
.nav-thrid-level {
    li {
        a {
            padding: 8px 20px 8px 10px;
            color: $menu-item;
            display: block;
            position: relative;
            transition: all 0.4s;
            font-size: 0.8125rem;
            &:focus,
            &:hover {
                color: $menu-item-hover;
            }
        }
    }
}

.nav-second-level {
    >li {
        >a {
            padding-left: 68px;
        }
    }
    li.active {
        >a {
            color: $menu-item-active;
        }
    }
}

.nav-third-level {
    >li {
        >a {
            padding-left: 83px;
        }
    }
    li.active {
        >a {
            color: $menu-item-active;
        }
    }
}

// Logo
.logo {
    display: block;
    span.logo-lg {
        display: block;
    }
    span.logo-sm {
        display: none;
    }
}

// Wrapper
#wrapper {
    height: 100%;
    overflow: hidden;
    width: 100%;
}

//Content Page
.content-page {
    margin-left: $leftbar-width;
    overflow: hidden;
    padding: 5px 20px;
    min-height: 80vh;
}

// Sidemenu
.left-side-menu {
    width: $leftbar-width;
    z-index: 10;
    background: $bg-leftbar;
    border-right: 2px solid darken($bg-leftbar,2%);
    bottom: 0;
    padding: 30px 0;
    position: fixed;
    transition: all .2s ease-out;
    top: 0;
}

// Sidebar
#sidebar-menu {
    >ul {
        >li {
            >a {
                color: $menu-item;
                display: block;
                padding: 10px 30px;
                margin: 5px 0;
                font-size: 0.9375rem;
                position: relative;
                transition: all 0.4s;
                &:hover,
                &:focus,
                &:active {
                    color: $menu-item-hover;
                    text-decoration: none;
                }
                >span {
                    vertical-align: middle;
                }

                i {
                    display: inline-block;
                    line-height: 1.0625rem;
                    margin: 0 10px 0 3px;
                    text-align: center;
                    vertical-align: middle;
                    width: 20px;
                }
                .drop-arrow {
                    float: right;
                    i {
                        margin-right: 0;
                    }
                }
            }
            > a.active {
                color: $menu-item-active;
            }
        }
    }
    .menu-arrow {
        transition: transform .15s;
        position: absolute;
        right: 30px;
        display: inline-block;
        font-family: 'Material Design Icons';
        text-rendering: auto;
        line-height: 1.5rem;
        font-size: 1.1rem;
        transform: translate(0, 0);
        &:before {
            content: "\F142";
        }
    }
    .badge{
        margin-top: 4px;
    }

    li.active {
        > a {
            > span.menu-arrow {
                transform: rotate(90deg);
            }
        }
    }

    .menu-title {
        padding: 12px 30px;
        letter-spacing: .05em;
        pointer-events: none;
        cursor: default;
        font-size: 0.6875rem;
        text-transform: uppercase;
        color: $menu-item;
    }
}

// Enlarge menu
.enlarged #wrapper {
    // Side menu
    .left-side-menu {
        position: absolute;
        padding-top: 0;
        width: 70px;
        z-index: 5;

        .slimScrollDiv,
        .slimscroll-menu {
            overflow: inherit !important;
            height: auto !important;
        }
        .slimScrollBar {
            visibility: hidden;
        }

        // Sidebar Menu
        #sidebar-menu {
            .menu-title,
            .menu-arrow,
            .label,
            .badge,
            .collapse.in {
                display: none !important;
            }
            .nav.collapse {
                height: inherit !important;
            }
            
            > ul {
                > li {
                    position: relative;
                    white-space: nowrap;

                    > a {
                        padding: 15px 20px;
                        min-height: 56px;
            
                        &:hover,
                        &:active,
                        &:focus {
                            color: $menu-item-hover;
                        }
                        i {
                            font-size: 1.125rem;
                            margin-right: 20px;
                        }

                        span {
                            display: none;
                            padding-left: 10px;
                        }
                    }
                    
                    &:hover  {
                        > a {
                            position: relative;
                            width: 260px;
                            color: $white;
                            background-color: $primary;

                            span {
                                display: inline;
                            }
                        }

                        a.open,a.active {
                            :after {
                                display: none;
                            }
                        }

                        > ul {
                            display: block;
                            left: 70px;
                            position: absolute;
                            width: 190px;
                            height: auto !important;
                            box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.02), 0 1px 0 0 rgba(0, 0, 0, 0.02);
                            a {
                                box-shadow: none;
                                padding: 8px 20px;
                                position: relative;
                                width: 190px;
                                z-index: 6;
                                &:hover {
                                    color: $menu-item-hover;
                                }
                            }
                        }
                    }
                }

                ul {
                    margin-top: -5px;
                    padding: 5px 0;
                    z-index: 9999;
                    background-color: $bg-leftbar;

                    li {
                        &:hover {
                            > ul {
                                display: block;
                                left: 190px;
                                margin-top: -36px;
                                position: absolute;
                                width: 190px;
                            }
                        }

                        > a {
                            span.pull-right {
                                position: absolute;
                                right: 20px;
                                top: 12px;
                                transform: rotate(270deg);
                            }
                        }
                    }
                    li.active {
                        a {
                            color: $menu-item-active;
                        }
                    }
                }
            }
        }
    }

    // Help Box
    .help-box {
        display: none;
    }

    // Content Page
    .content-page {
        margin-left: 70px;
    }

    //Footer
    .footer {
        left: 70px;
    }
}

// Body min-height set
body.enlarged {
    min-height: 1200px;
}

@media (max-width: 1024px) {
    .logo {
        span.logo-lg {
            display: none;
        }
        span.logo-sm {
            display: block;
            line-height: 70px;
            color: $primary;
        }
    }
}

@include media-breakpoint-down(sm) {
    body {
        overflow-x: hidden;
    }
    .left-side-menu {
        display: none;
        z-index: 10 !important;
    }
    .sidebar-enable {
        .left-side-menu {
            display: block;
        }
    }
    .navbar-nav.navbar-right {
        float: right;
    }
    .content-page {
        margin-left: 0 !important;
        padding: 5px 10px;
    }
    .enlarged {
        .left-side-menu {
            margin-left: -70px;
        }
    }
    .logo {
        span.logo-lg {
            display: block;
        }
        span.logo-sm {
            display: none;
        }
    }
    .pro-user-name {
        display: none;
    }
}

/* =============
  Small Menu
============= */

.left-side-menu-sm {
    width: $leftbar-width-sm;
    text-align: center;
    #sidebar-menu {
        > ul {
            > li {
                > a {
                    > i {
                        display: block;
                        font-size: 18px;
                        line-height: 24px;
                        width: 100%;
                        margin: 0;
                    }
                }
            }
            ul  {
                a {
                    padding: 10px 20px;
                }
            }
        }
    }
    .menu-arrow,
    .badge {
        display: none !important;
    }
    &+.content-page {
        margin-left: $leftbar-width-sm;
    }
    + .content-page .footer {
        left: $leftbar-width-sm;
    }
}

.enlarged {
    #wrapper {
        .left-side-menu-sm {
            text-align: left;

            ul {
                li {
                    a {
                        i {
                            display: inline-block;
                            font-size: 18px;
                            line-height: 17px;
                            margin-left: 3px;
                            margin-right: 15px;
                            vertical-align: middle;
                            width: 20px;
                        }
                    }
                }
            }
        }
    }
}


/* =============
  Menu - Dark
============= */

// Leftbar-dark
.left-side-menu-dark {
    background-color: $bg-leftbar-dark;
    box-shadow: none;
    border-right: 2px solid lighten($bg-leftbar-dark,2%);

    #sidebar-menu {
        > ul {
            > li{
                > a {
                    color: $menu-item-color-dark;
    
                    &:hover,
                    &:focus,
                    &:active {
                        color: $menu-item-hover-color-dark;
                    }
                }
                > a.active {
                    color: $menu-item-active-color-dark;
                    background-color: lighten($bg-leftbar-dark, 5%);
                    border-right-color: $menu-item-active-color-dark;
                }
            }
        }

        .menu-title {
            color: $gray-500;
        }
    }

    .nav-second-level,
    .nav-thrid-level {
        li {
            a {
                color: $menu-item-color-dark;
                &:focus,
                &:hover {
                    background-color: transparent;
                    color: $menu-item-hover-color-dark;
                }
            }
        }
    }

    .nav-second-level,
    .nav-third-level {
        li.active {
            >a {
                color: $menu-item-active-color-dark;
            }
        }
    }
}


.enlarged #wrapper {
    .left-side-menu-dark {
        #sidebar-menu {
            > ul {
                > li {
                    &:hover >a {
                        background-color: lighten($bg-leftbar-dark,5%);
                    }
                }
            }
        }
    }
}
